<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page import="priv.project.util.ServletUtils" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="content-security-policy" content="upgrade-insecure-requests"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="renderer" content="webkit"/>
<meta name="force-rendering" content="webkit"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>文旅网</title>

<link type="text/css" rel="stylesheet" href="<%= ServletUtils.getProjectHttpUrl(request)%>/css/web_css/style.css" />
  <link type="text/css" rel="stylesheet" href="<%= ServletUtils.getProjectHttpUrl(request)%>/lib/layui/css/layui.css"/>
  <script type="text/javascript" src="<%= ServletUtils.getProjectHttpUrl(request)%>/js/jquery.min.js"></script>
<script type="text/javascript" src="<%= ServletUtils.getProjectHttpUrl(request)%>/js/web_js/banner.js"></script>
  <script type="text/javascript" src="<%= ServletUtils.getProjectHttpUrl(request)%>/js/MyLayuiUtils.js"></script>
  <script type="text/javascript" src="<%= ServletUtils.getProjectHttpUrl(request)%>/lib/layui/layui.js"></script>
    <script type="text/javascript" src="<%= ServletUtils.getProjectHttpUrl(request)%>/js/jquery.min.js"></script>
    <script charset="utf-8" src="https://map.qq.com/api/gljs?v=1.exp&key=IEBBZ-L44W4-LLBUS-FY5OZ-UP5NF-VIBZD"></script>

    <style>
        #container {
            width: 100%;
            height: 400px;
            margin: 0 auto;
        }
    </style>
</head>

<body>

<!-- 引入公共的头部导航条 -->
<%@include file="header.jsp"%>

<div class="clear"></div>

<!-- 引入公共的轮播图部分 -->
<%@include file="banner.jsp"%>

<div class="clear"></div>
<div class="mabody">
<div class="mainWarp">
  <div class="mainRight" style="float: none; margin: 0 auto; min-width: 900px">
    <div class="brandnavbox">
       <p class="ccsl">景点详情</p>
       <div class="con ccsl">
         <a href="javascript:;" onclick="window.history.back();">返回</a>
       </div>
    </div>
    <div class="detailbox">
      <div class="xq">
        <h1>${obj.name}</h1>
        <div class="date">发布时间:<fmt:formatDate value="${(obj.createDate)}" pattern="yyyy-MM-dd HH:mm:ss"/></div>
        <img src="${obj.headImg}" class="pprooimg"/>
        <div class="con">
          ${obj.readme}
        </div>
          <div id="container" ></div>
          <script type="text/javascript">
              var center = new TMap.LatLng(${obj.lat},${obj.lng});
              //初始化地图
              var map = new TMap.Map("container", {
                  zoom: 12, //设置地图缩放级别
                  center: center //设置地图中心点坐标
              });
          </script>
<%--        <div style="text-align: center">--%>
<%--          <a href="${obj.skipUrl}" style="font-size: 18px" target="_blank">前往官网 >></a>--%>
<%--        </div>--%>

      </div>
        <div class="clear"></div>
        <div class="brandnavbox">
            <p class="ccsl">景点评分</p>
        </div>
        <div>

            <li >
                <h1>${obj.rate.rateSum==null? 0:obj.rate.rateSum}</h1>
                <div id="test6" ></div>
            </li>
            <li ><span>${(countN==null||countN==0)?0:countN}位用户评分</span></li>
            <ul >
                <li>吃喝：<div id="test0" ></div></li>
                <li>住宿：<div id="test1" ></div></li>
                <li>出行：<div id="test2" ></div></li>
                <li>游玩：<div id="test3" ></div></li>
                <li>购物：<div id="test4" ></div></li>
                <li>娱乐：<div id="test5" ></div></li>
            </ul>
        </div>
        <div class="clear"></div>
        <div class="brandnavbox">
            <p class="ccsl">文化背景</p>
        </div>
               <%--文化背景--%>
        <div class="xq">
        <div class="con">
        ${obj.cultural}
        </div>
        </div>

  </div>
  <div class="clear"></div>
</div>
</div>
<div class="clear"></div>

<!-- 引入公共的底部部分 -->
<%@include file="footer.jsp"%>

    <script>
        layui.use(['rate'], function() {
            let arr_value = [0, 0, 0, 0, 0, 0];
            let sendParam = {
                "id":${obj.rate.id},
                "userId":${sessionScope.webUser.id==null ?0:sessionScope.webUser.id},
                "scenicId":${obj.id},
                "rateOne":${obj.rate.rateOne==0?0:obj.rate.rateOne},
                "rateTwo":${obj.rate.rateTwo==0?0:obj.rate.rateTwo},
                "rateThree":${obj.rate.rateThree==0?0:obj.rate.rateThree},
                "rateFour":${obj.rate.rateFour==0?0:obj.rate.rateFour},
                "rateFive":${obj.rate.rateFive==0?0:obj.rate.rateFive},
                "rateSix":${obj.rate.rateSix==0?0:obj.rate.rateSix}
            };
            const rate = layui.rate;
            rate.render({
                elem: '#test0'
                , theme: '#FF8000'
                ,value:${obj.rate.rateOne==null? 1:obj.rate.rateOne}
                , readonly: ${obj.rate.isRate==null?0:obj.rate.isRate}
                , choose: function (value) {
                    arr_value[0] = value;
                    sendParam.rateOne=arr_value[0];
                    rate.render({
                        elem: '#test0'
                        , value: value

                    });
                    console.log(arr_value);
                    console.log(sendParam);
                    sendAjax("<%= ServletUtils.getProjectHttpUrl(request)%>web/rate/updateRate"
                        ,"POST"
                        , sendParam
                        , (res)=>{
                        window.location.reload();
                        console.log(res);
                        })
                }


            });
            rate.render({
                elem: '#test1'
                , theme: '#009688'
                ,value:${obj.rate.rateTwo==null? 1:obj.rate.rateTwo}
                , readonly: ${obj.rate.isRate==null?0:obj.rate.isRate}
                , choose: function (value) {
                    arr_value[1] = value;
                    sendParam.rateTwo=arr_value[1];
                    rate.render({
                        elem: '#test1'
                        , value: value
                    });
                    console.log(arr_value);
                    sendAjax("<%= ServletUtils.getProjectHttpUrl(request)%>web/rate/updateRate"
                        ,"POST"
                        , sendParam
                        , (res)=>{
                            window.location.reload();
                            console.log(res);
                        })
                }
            });
            rate.render({
                elem: '#test2'
                , half: true
                , theme: '#1E9FFF'
                ,value:${obj.rate.rateThree==null? 1:obj.rate.rateThree}
                , readonly: ${obj.rate.isRate==null?0:obj.rate.isRate}
                , choose: function (value) {
                    arr_value[2] = value;
                    sendParam.rateThree=arr_value[2];
                    rate.render({
                        elem: '#test2'
                        , value: value
                    });
                    console.log(arr_value);
                    sendAjax("<%= ServletUtils.getProjectHttpUrl(request)%>web/rate/updateRate"
                        ,"POST"
                        , sendParam
                        , (res)=>{
                            window.location.reload();
                            console.log(res);
                        })
                }
            });
            rate.render({
                elem: '#test3'
                , half: true
                , theme: '#2F4056'
                ,value:${obj.rate.rateFour==null? 1:obj.rate.rateFour}
                , readonly: ${obj.rate.isRate==null?0:obj.rate.isRate}
                , choose: function (value) {
                    arr_value[3] = value;
                    sendParam.rateFour=arr_value[3];
                    rate.render({
                        elem: '#test3'
                        , value: value
                    });
                    console.log(arr_value);
                    sendAjax("<%= ServletUtils.getProjectHttpUrl(request)%>web/rate/updateRate"
                        ,"POST"
                        , sendParam
                        , (res)=>{
                            window.location.reload();
                            console.log(res);
                        })
                }
            });
            rate.render({
                elem: '#test4'
                , half: true
                , theme: '#FE0000'
                ,value:${obj.rate.rateFive==null? 1:obj.rate.rateFive}
                , readonly: ${obj.rate.isRate==null?0:obj.rate.isRate}
                , choose: function (value) {
                    arr_value[4] = value;
                    sendParam.rateFive=arr_value[4];
                    rate.render({
                        elem: '#test4'
                        , value: value
                    });
                    console.log(arr_value);
                    sendAjax("<%= ServletUtils.getProjectHttpUrl(request)%>web/rate/updateRate"
                        ,"POST"
                        , sendParam
                        , (res)=>{
                            window.location.reload();
                            console.log(res);
                        })
                }
            });
            rate.render({
                elem: '#test5'
                , half: true
                , theme: '#1e9fff'
                ,value:${obj.rate.rateSix==null? 1:obj.rate.rateSix}
                , readonly: ${obj.rate.isRate==null?0:obj.rate.isRate}
                , choose: function (value) {
                    arr_value[5] = value;
                    sendParam.rateSix=arr_value[5];
                    rate.render({
                        elem: '#test5'
                        , value: value
                    });
                    console.log(arr_value);
                    sendAjax("<%= ServletUtils.getProjectHttpUrl(request)%>web/rate/updateRate"
                        ,"POST"
                        , sendParam
                        , (res)=>{
                            window.location.reload();
                            console.log(res);
                        })
                }

            });
            rate.render({
                elem: '#test6'
                , half: true
                , theme: '#daea45'
                ,value:${obj.rate.rateSum==null? 1:obj.rate.rateSum}
                , readonly: true

            });
        });


    </script>
</body>
</html>                      
